package com.surprise.db.dao;

import java.util.List;

import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Repository;

import com.surprise.db.po.AppMockup;

/**
 * 
 * @author nick
 * @since 2015-04-29
 */
@Repository
public class AppMockupDAO extends SimpleDAO<AppMockup> {
	public List<AppMockup> getByApiId(int apiId) {
        StringBuilder sb = new StringBuilder();
        sb.append("select * from ")
                .append(getTableName())
                .append(" where api_id = ? order by updatetime desc");
        String sql = sb.toString();
        List<AppMockup> ret = jdbcTemplate.query(sql,
                new Object[] { apiId }, new BeanPropertyRowMapper<AppMockup>(
                        AppMockup.class));
        return ret;
    }
}
